import { OptionTypes } from '@/utils/types.d';
import { VehicleTypeEnum } from '../Parking/Records/types.d';
import { MemberCardType } from './MemberRecord/types.d';
import { MemberCardTableItem } from './MemberCard/types.d';

export const mapVehicleType = (val: VehicleTypeEnum) => {
  switch (val) {
    case VehicleTypeEnum.COMMON_SMALL:
      return '普通小型车';
    case VehicleTypeEnum.COMMON_LARGE:
      return '普通大型车';
    case VehicleTypeEnum.NEW_ENERGY_SMALL:
      return '新能源小型车';
    case VehicleTypeEnum.NEW_ENERGY_LARGE:
      return '新能源大型车';
    case VehicleTypeEnum.POLICE:
      return '警车';
    case VehicleTypeEnum.ARMED:
      return '武警';
    default:
      return '普通小型车';
  }
};

export const zhMemberCard = (type: string) => {
  switch (type) {
    case MemberCardType.MONTH:
      return '月卡';
    case MemberCardType.YEAR:
      return '年卡';
    case MemberCardType.SEASON:
      return '季卡';
    default:
      return '无法识别';
  }
};

export const mapOptions = (item: MemberCardTableItem) => {
  let options: OptionTypes[] = [];
  if (!item.typeInfo) return options;
  options = Object.keys(item.typeInfo).map((item) => ({
    label: zhMemberCard(item),
    value: item,
  }));
  return options;
};
